<section class="section {page->class}">
	<h2 class="hide">{page->title}</h2>

	<script>
		$(function() {
			$("#{module}_add").validate({
				submitHandler : function(form) {
					// ajax로 등록후 list 페이지 새로 고침
					$.ajax({
						 url : form.action
						,data : $(form).serialize()
						,success:function(data){
							if(data.code == mesg.success) {
								if(data.menu_refresh_url) {
									$("aside#left menu").load(data.menu_refresh_url);
								}
								sagapo.section_refresh(data.return_url);
							} else {
								alert(data.msg);
							}
							
							return false;
						}
					});
				}
			});
			
			
			// 메뉴 아이콘 선택 창 표시
			$("button.menu_icon_select").click(function() {
				$("#menu_iconset").dialog('open');	
				
				return false;
			});
			
			
			// 반드시 id값으로 설정해줘야됨.
			// class로 하면 dialog가 제대로 열리지 않음.
			$("#menu_iconset").dialog({
				resizable	: false,
				modal		: true,
				width		: 500,
				minWidth	: 500,
				height		: 500,
				autoOpen	: false,
				title		: '아이콘 선택'
				
			});
			
			// 아이콘 선택시..
			$("#menu_iconset .iconset .icon").click(function() {
				
				$(".select_icon").html($(this).clone());
				
				$("#{module}_icon").val($(this).attr("alt"));
				$("#menu_iconset").dialog('close');
				return false;
			});
		});
	</script>
	<form name="{module}_add" id="{module}_add" method="post" action="{action}/doAdd">
		<table class="table">
			<caption>
				{page->title}
			</caption>
			<colgroup>
				<col class="add" />
				<col />
			</colgroup>
			<tbody>
				<tr>
					<th scope="row" class="txt_right br"><label for="{module}_name">메뉴 명</label></th>
					<td><input type="text" name="{module}_name" id="{module}_name" class="width_90 required" placeholder="메뉴 명" /></td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br">아이콘 선택</th>
					<td>
						<div class="select_icon"></div>
						<button type="button" class="menu_icon_select">아이콘 선택</button>
						<input type="hidden" name="{module}_icon" id="{module}_icon" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="{module}_url">URL</label></th>
					<td>
						<input type="text" name="{module}_url" id="{module}_url" class="width_90 required" value="http://" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="{module}_external_on">새창</label></th>
					<td>
						<input type="radio" name="{module}_external" id="{module}_external_on" value="1" />
						<label for="{module}_external_on">사용</label>
						&nbsp;&nbsp;
						<input type="radio" name="{module}_external" id="{module}_external_off" value="0" checked="checked" />
						<label for="{module}_external_off">미사용</label>
					</td>
				</tr>
			</tbody>
		</table>
		<div class="button_area">
			<button type="submit">전송</button>
		</div>
		
		<div id="menu_iconset">
			<ul class="iconset">
				{@ iconset}
				<li>
					<img src="{CFG->PATH->IMAGE}/iconset/{.value_->name}" alt="{.value_->name}" title="{.value_->name}" class="icon" />
				</li>
				{/}
			</ul>
		</div>
	</form>
</section>